#include ("/_includes/_layout.html")
#@layout("点步插件平台-公众号管理", "wxmall,点步科技", "Wxmall社区","wxmall")
#define content()
<div class="wrapper wrapper-content">
	
	<div class="panel-body">
		<div style="float: left; margin-right: 20px;">
		<a href="#(webctx)/youzan/auth?rUrl=/authshop/index" class="btn btn-success btn-sm"><i class="glyphicon glyphicon-plus"></i>&nbsp;新增有赞店铺&nbsp;<i class="fa fa-question-circle" onmouseout="layer.closeAll();" onmouseover="layer.tips('一键授权绑定您的有赞店铺。', this, {tips: [1, '#3595CC'],time: 0});"></i></a>
		</div>
		<div id="pager" class="jqpager" style="margin-bottom: 1px;"></div>	
	</div>
	
	<table id="mainTable" class="table table-striped table-bordered bootstrap-datatable datatable" border="0">
	  <thead>
		  <tr>
			<th><input type="checkbox" id="all" title="全选/反选" style="margin-right: 4px; vertical-align: middle;"/></th>
			<th>店铺名称</th>
			<th>sid</th>
			<th>accessToken</th>
			<th>refresh_token</th>
			<th>授权时间</th>
		  </tr>
	  </thead>   
	  <tbody class="itemsLotGrid"></tbody>
  	</table>
	
</div>

<script type="text/html" id="item_table_tr_tpl">
{{each list as item i}}
		<tr class="package">
			<td>
				<input type="checkbox" class="commchk" id="checkbox_{{item.id}}" style="margin-right: 4px; vertical-align: middle;"/>
			</td>
			<td><img src="{{item.shopLogo}}" width="30" height="30">&nbsp;&nbsp;{{item.shopName}}</img></td>
			<td>{{item.sid}}</td>
			<td>{{item.accessToken}}</td>
			<td>{{item.refreshToken}}</span></td>
			<td>{{item.created}}</td>
		</tr>
{{/each}}
</script>
<script type="text/template" id="table_noresult_tr_tpl">
	<tr class="package"><td colspan="6" class="center">没有结果集</td></tr>
</script>
#end
<script type="text/javascript">
$(document).ready(function() {
	var table = new obz.TableView("pager", obz.ctx + "/authshop/list", {}, function(resp){
		$(".itemsLotGrid").empty();
		if(resp && resp.list && resp.list.length>0){
			$('.itemsLotGrid').html(template('item_table_tr_tpl', resp));
			//初始化checkbox点击事件
			TBatch.checkCheckbox();
			TBatch.initCheckboxClick();
		}else{
			$(".itemsLotGrid").append($("#table_noresult_tr_tpl").html());
		}
	});
	table.init();
});
</script>